package com.samphanie.admin.security;

import com.samphanie.admin.modules.sys.service.ISysClientService;
import com.samphanie.security.domain.OauthClient;
import com.samphanie.security.security.service.OauthClientService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
 * @author ZSY
 * @date 2021/11/9 9:39
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class OauthClientDetailsServiceImpl implements OauthClientService {

    private final ISysClientService sysClientService;

    /**
     * 查询客户端信息
     *
     * @param clientId 客户端ID
     * @return OauthClient
     */
    @Override
    public Optional<OauthClient> loadClientByClientId(String clientId) {
        return Optional.ofNullable(sysClientService.loadClientByClientId(clientId));
    }
}
